SPB Git

Repository Public

route.ts 734 B 16 lines typescript

1import { mediaStorage } from "@/lib/content";2import { notFoundResponse, serveObject } from "@/lib/serve";3import { currentSession } from "@/lib/studio/guard";45export const dynamic = "force-dynamic";67/**8 * Media for signed-in editors: the private preview's player, and the posters, thumbnails and caption files9 * shown in the capsule manager. An anonymous request gets the same 404 as for a file that does not exist.10 */11async function handle(request: Request, { params }: { params: Promise<{ path: string[] }> }) {12  if (!(await currentSession())) return notFoundResponse();13  return serveObject(mediaStorage(), (await params).path.join("/"), request, { cache: "private, no-store" });14}15export { handle as GET, handle as HEAD };16
Files main
Menu

Theme